<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      /* .fade-enter-active,
      .fade-leave-active {
        transition: opacity 0.5s;
      }
      .fade-enter, .fade-leave-to {
        opacity: 0;
      } */

      /* .fade-enter-active,
      .fade-leave-active {
        transition: all 0.5s;
      }
      .fade-enter {
        transform: translateX(20px);
        opacity: 0;
      }
      .fade-leave-to {
        transform: translateX(-20px);
        opacity: 0;
      } */

      .slide-fade-enter-active {
        transition: all 0.3s ease;
      }
      .slide-fade-leave-active {
        transition: all 0.8s cubic-bezier(1, 0.5, 0.8, 1);
      }
      .slide-fade-enter, .slide-fade-leave-to
/* .slide-fade-leave-active for below version 2.1.8 */ {
        transform: translateX(10px);
        opacity: 0;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <button v-on:click="show = !show">Toggle</button>
      <!-- 给需要显示和隐藏的元素或者组件外面加transition标签 -->
      <!-- 需要一个name属性 -->
      <transition name="slide-fade">
        <p v-if="show">hello</p>
      </transition>
    </div>

    <script src="../../Vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {
          show: true,
        },
      });
    </script>
  </body>
</html>
